<template>
  <div class="wrapper" ref="wrapper"> <!--用ref标签引用标签元素更准确-->
    <div>
      <slot></slot>
    </div>
  </div>
</template>

<script>
import BScroll from "better-scroll";

export default {
  name: "Scroll",
  data() {
    return {
      bScroll: null
    }
  },
  mounted() {
    this.bScroll = new BScroll(this.$refs.wrapper, {
      click: true, //解决作为子组件使用后按钮无法点击
      observeDOM: true, //解决作为子组件使用后无法滚动
      mouseWheel: true, //开启鼠标滚轮滑动
      scrollY: true,
      scrollbar: {
        fade: true,
        interactive: false // 1.8.0 新增
      },
    });
  }
}
</script>

<style scoped>

</style>